package main

import (
	"fmt"
	"time"
)

// Calculate the nth Fibonacci number
func fib(n int) int64 {
	if n <= 2 {
		return 1
	}
	a, b := int64(1), int64(1)
	for i := 3; i <= n; i++ {
		a, b = b, a+b
	}
	return b
}

func main() {
	start := time.Now()

	var result int64
	num := 0

	// Call the fib function
	for i := 1; i <= 500; i++ {
		result = fib(i)
		num = i // Just to keep the same variable name as in the original code
	}

	// Record end time and print results
	duration := time.Since(start)
	fmt.Printf("Go time: %v\nFibonacci number is: %d\n", duration, result)
	fmt.Printf("num = %d\n", num)
}
